﻿using System.ComponentModel.DataAnnotations;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows.Data;

namespace Tanmia.Warehouse.Core
{
    partial class Item
    {
        public virtual bool IsSelected { get; set; }

        [Display(ShortName = "اسم التصنيف", Order = 7, AutoGenerateField = true)]
        public virtual string ItemCategoryName
        {
            get { return Category == null ? ItemCategory.HeadName : Category.Name; }
        }

        private ObservableCollection<ItemUnit> itemUnitCollection;
        public virtual ObservableCollection<ItemUnit> ItemUnitCollection
        {
            get
            {
                if (itemUnitCollection == null)
                {
                    itemUnitCollection = new ObservableCollection<ItemUnit>(ItemUnits);
                    itemUnitCollection.CollectionChanged += (s, e) => RaisePropertyChanged(() => ItemUnits);
                }
                return itemUnitCollection;
            }
        }
    }
}
